package com.fy.dao;

import com.fy.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select * from user")
    List<User> findAll();

    @Select("select * from user where user_id=#{user_id}")
    List<User> getInfo(@Param("user_id")String user_id);

    @Insert("insert into user (`user_id`, `user_account`, `user_pwd`, `user_tel`,`user_state`) " +
            "values (#{user_id},#{user_account},#{user_pwd},#{user_tel},#{user_state})")
    int insert(@Param("user_id") String user_id, @Param("user_account")
            String user_account, @Param("user_pwd") String user_pwd,
               @Param("user_tel") String user_tel, @Param("user_state") String user_state);

    @Select("select * from user where user_account=#{user_account} and user_pwd=#{user_pwd}")
    int query(@Param("user_account") String user_account, @Param("user_pwd") String user_pwd);

    @Update("update user set `user_pwd`=#{user_pwd} where user_id=#{user_id}")
    int revise(@Param("user_pwd") String user_pwd, @Param("user_id") String user_id);

}
